package com.lyc.common.bean;

import javax.annotation.Resource;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

import com.lyc.common.config.MybatusPlusConfig;

/**
 * @Author 李大神仙
 * @Date 2024/3/2 14:37
 * @Version 1.0
 */

public class BeanPostProcessor implements ApplicationContextAware,org.springframework.beans.factory.config.BeanPostProcessor {

    @Resource
    private MybatusPlusConfig mybatusPlusConfig;

    @Override
    //public void setApplicationContext(@Nonnull ApplicationContext applicationContext) throws BeansException {
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {

    }

    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
       /* if (CommonConstants.BEAN_NAME_MYBATISPLUS.equals(beanName)){
            //如果遇到需要替换bean，我们直接换成自已实现的bean即可
            return mybatusPlusConfig.mybatisPlusInterceptor();
        }*/
        return bean;
    }
}
